package fanalg;

/**
 * Class representing circuit entity
 * @author Tomasz Werszko
 *
 */
public class CircuitEntity {
	/**
	 * Stores array of input names
	 */
	public String[] inputs;
	
	/**
	 * Stores values on input
	 */
	public LogicSystem [] inValues;
	/**
	 * Stores value on output
	 */
	public LogicSystem outValue;
	
	/**
	 * Stores name of the output of the gate
	 */
	public String output = "";
	
	public int distanceToPO = -1;
	
	/**
	 * 
	 */
	protected boolean faulty = false;
	
	/**
	 * 0 controllability
	 */
	public int CC0 = -1;
	/**
	 * 1 controllability
	 */
	public int CC1 = -1;
	
	public String toString(){
		String string = "";
		for(int i = 0; i < this.inputs.length; i++){
			string += " " + inputs[i];
		}
		
		string += " " + this.output;
		return string;
	}
	
	public boolean isFaulty(){
		return this.faulty;
	}
	
	/**
	 * Marks the entity as faulty
	 * @return if the entity has already been faulty returns false, else return true
	 */
	public boolean setFaulty(){
		if(this.faulty){
			return false;
		}else{
			this.faulty = true;
			return true;
		}
	}
	
	public LogicSystem evaluate(LogicSystem[] inputs){
		return LogicSystem.X;
	}

}
